﻿using System;
using DBAccess;
using System.Collections.Generic;

namespace SD.Database
{
    public class AllianceFunctions
    {
        public static void AddPlayerToAlliance(int pId, int aId)
        {
            DAL.GetInstance().InsertData("Insert into AllianceMembers Values(@param0, @param1)", new List<object> { aId, pId });
        }
        public static void CreateAlliance(string name, string password, string page)
        {
            DAL.GetInstance().InsertData("Insert into AllianceMembers Values(@param0, @param1, @param2)", new List<object> { name, page, password });
        }
        public static string GetAllianceName(int id)
        {
            return DAL.GetInstance().GetScalar("Select Name From Alliances Where AllianceID = @param0", new List<object>() { id });
        }
        public static int GetAllianceId(string name)
        {
            return DAL.GetInstance().GetInt("Select AllianceID From Alliances Where Name = @param0", new List<object> { name });
        }
        public static string GetAlliancePassword(int id)
        {
            return DAL.GetInstance().GetScalar("Select Password From Alliances Where AllianceID = @param0", new List<object> { id });
        }
    };
}